#include <iostream>
#include <string>
using namespace std;

#include "Console.h"
using namespace Course;

#include "tictactoe.h"

int main(){
	string p1, p2;
	tictactoe board;
	int winner;

	cout << "Spelare 1: ";
	cin >> p1;
	cout << "Spelare 2: ";
	cin >> p2;

	while(1){
		board.drawBoard();
		board.play();
		winner = board.checkWin();
		if(winner == 'x'){
			Console::gotoxy(10,0);
			cout << "Vinnare: " << p1 << endl;
			break;
		}
		else if(winner == 'o'){
			Console::gotoxy(10,0);
			cout << "Vinnare: " << p2 << endl;
			break;
		}
		else if(winner == 'd'){
			Console::gotoxy(10,0);
			cout << "Oavgjort! " << endl;
			break;
		}
	}
	system("pause");
	return 0;
}
